package com.czl.websocket;

import com.czl.websocket.server.ChatMatchService;
import com.czl.websocket.server.ServerDemo;
import com.czl.websocket.server.WebSockeManger;
import org.springframework.boot.CommandLineRunner;
import org.springframework.stereotype.Component;

import java.net.UnknownHostException;

@Component
public class CommandLineRunnerImpl implements CommandLineRunner {
    @Override
    public void run(String... args) throws Exception {

        System.out.println("==========socket启动ing......");
        new Thread(new Runnable() {
            @Override
            public void run() {
                try {
                    new ServerDemo(9898).start();
                } catch (UnknownHostException e) {
                    e.printStackTrace();
                }
            }
        }).start();

        new Thread(new Runnable() {
            @Override
            public void run() {
                WebSockeManger.aliveCheck();
            }
        }).start();

        new Thread(new Runnable() {
            @Override
            public void run() {
                ChatMatchService.mathTask();
            }
        }).start();


    }
}